﻿<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-label="Close" ng-click="cancel()">
        <span aria-hidden="true">&times;</span>
    </button>
    <h3 class="modal-title">{{show_upload?"上传图片":"我的图片"}}</h3>
</div>
<div class="modal-body">
    <div class="row" ng-show="show_upload==false">
        <div class="col-sm-3">
            <div class="list-group">
                <a href="javascript:void(0)" ng-class="query.category_id==item.id?'active':''" class="list-group-item"
                   ng-repeat="item in file_categorys" ng-click="query.category_id=item.id;search()">
                    {{item.name}}
                </a>
            </div>
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-6 col-md-3" ng-repeat="file in files.rows">
                    <a href="javascript:void(0)" class="thumbnail" ng-click="choose(file.file_url);" ng-class="{'choose_image_item':image_paths.indexOf(file.file_url) != -1}" style="display:block;height:120px;">
                        <img alt="{{file.file_name}}" ng-src="{{site.img_url}}{{file.file_url}}_100x100.{{file.file_type}}" data-holder-rendered="true" style="display: block;">
                    </a>
                </div>
            </div>
            <div class="row">
                <div class="col-md-12">
                    <uib-pagination total-items="files.total_result" items-per-page="query.size" ng-model="query.page" num-pages="files.total_pages"
                                    ng-change="search()" class="pagination-sm" boundary-links="true"
                                    previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></uib-pagination>
                    <span class="pull-right" style="margin: 30px 0px 20px 0px">共{{files.total_result}} 当前：{{files.page}}/{{files.total_pages}}</span>
                </div>
            </div>
        </div>
    </div>
    <div class="row" ng-show="show_upload">
        <div class="col-sm-12">
            <form name="_form" class="form-horizontal w5c-form" w5c-form-validate="model.validateOptions" novalidate role="form">
                <div class="form-group">
                    <label class="col-sm-2 control-label">网络图片</label>
                    <div class="col-sm-10">
                        <div class="input-group">
                            <input type="url" name="web_image_url" class="form-control input-sm" ng-model="web_image_url" placeholder="如:http://www.****.com/images/nopic.jpg">
                            <span class="input-group-btn">
                                <button type="submit" w5c-form-submit="upload_web_file()" class="btn btn-primary btn-sm" btn-loading="psdisabled" loading-text="保存中..." ng-disabled="psdisabled">
                                    <i class="fa fa-save"></i> 提取
                                </button>
                            </span>
                        </div>
                        <div class="img-thumbnail" ng-show="web_image_url!=''">
                            <img ng-src="{{web_image_url}}" class="img_bg_w_h" />
                        </div>
                    </div>
                </div>
                <div class="form-group" ng-show="web_image_url!=''">
                    <label class="col-sm-2 control-label"></label>
                    <div class="col-sm-10">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">本地图片</label>
                    <div class="col-sm-10">
                        <div class="img-thumbnail pull-left" ng-repeat="file in uploadfiles" style="position:relative;margin-right:5px;margin-bottom:5px;">
                            <button type="button" class="close" ng-click="delete_file(file)" style="position:absolute;right:6px;">
                                <span aria-hidden="true">&times;</span>
                            </button>
                            <img ngf-thumbnail="file || '/content/images/upload_bg.png'" class="img_bg_w_h" ngf-no-object-url="true">
                        </div>
                        <div ngf-select ngf-drop ng-model="uploadfiles" ngf-pattern="'image/*'" multiple="multiple"
                             ngf-accept="'image/*'" ngf-max-size="1MB" style="position:relative;float:left;" class="img-thumbnail">
                            <img src="/content/images/upload_bg.png" class="img_bg_w_h">
                            <div style="position:absolute;top:50px;left:20px;">+选择图片</div>
                        </div>
                    </div>
                    <div class="col-sm-10 col-sm-offset-2" style="padding-top:10px;">仅支持jpg、gif、png三种格式, 大小不超过1 MB</div>
                </div>
            </form>
        </div>
    </div>
</div>
<div class="modal-footer" style="text-align: center;position:relative">
    <button class="btn btn-primary btn-sm" ng-click="ok()" ng-show="show_upload==false"><i class="fa fa-save"></i> 确认</button>
    <button class="btn btn-default btn-sm" ng-click="show_upload=true;" ng-show="show_upload==false"><i class="fa fa-upload"></i> 上传图片</button>
    <button class="btn btn-primary btn-sm" ng-click="upload_files()" ng-show="show_upload" btn-loading="upload_disabled" loading-text="保存中..." ng-disabled="upload_disabled"><i class="fa fa-upload"></i> 上传图片</button>
    <button class="btn btn-default btn-sm" ng-click="show_upload=false;search();" ng-show="show_upload"><i class="fa fa-rotate-left"></i> 返回我的图片</button>
    <span class="pull-right" ng-show="image_paths.length>0" style="position: absolute;right: 15px;top: 20px;">已选择{{image_paths.length}}张图片</span>
</div>